package com.feihao.zhou.demo01;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class ReflectGetValue {
    public static void main(String[] args) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException {

        FileInputStream fis = new FileInputStream("D:\\IdeaProjects\\Job-code\\666.properties");

        Properties prop = new Properties();

        prop.load(fis);

        Object o = prop.values();
        System.out.println("获取的value：" + o);

        String className = prop.getProperty("ClassName");
        Class clazz = Class.forName(className);

        Student student = (Student) clazz.newInstance();
        student.setAge(18);
        student.setName("张三");

        System.out.println(student);
    }
}
